package com.yunxi.yunxicaiproject.Controller;


import com.yunxi.yunxicaiproject.entity.po.AiActivity;
import com.yunxi.yunxicaiproject.entity.vo.ActivityParticipationVO;
import com.yunxi.yunxicaiproject.entity.vo.LeaveApplicationVO;
import com.yunxi.yunxicaiproject.entity.vo.ScheduleVO;
import com.yunxi.yunxicaiproject.tool.StudentTools;
import com.yunxi.yunxicaiproject.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/ai")
public class ActivityController {
    @Autowired
    StudentTools studentTools;

    @GetMapping("/activity/list")
    public R list() {
        List<AiActivity> activityList = studentTools.getActivityList();
        return R.ok().put("data", activityList);
    }

    @GetMapping("/activity")
    public R searchById(String studentId){
        if (studentId==null){
            return R.error("学生学号为空！");
        }
        List<ActivityParticipationVO> vos = studentTools.getActivityParticipationInfo(studentId);
        return R.ok().put("data", vos);
    }
}
